<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>导入收货地址</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header"><i class="fa fa-cog"></i> 导入收货地址</div>
				<div class="layui-card-body" pad15>
					<div class="layui-form" lay-filter="">
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:150px">上传EXCEL文件：</label>
							<div class="layui-input-inline" style="width:300px">
								<input type="text" name="upload_file" id="upload_file" class="layui-input">
							</div>
							<button style="float:left;" type="button" class="layui-btn layui-btn-primary uploadexcel" upload-input="upload_file">上传</button>
						</div>
						<div class="layui-form-item" style="padding:0 20px">
							<div class="layui-form-mid" style="color:red;">请按导入格式进行导入</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:150px"></label>
							<div class="layui-form-mid"> <a href="__STATIC__/demo_addressdr.xls">点击下载查看导入格式</a></div>
						</div>
						<div class="layui-form-item">
							<div class="layui-input-block" style="margin-left:160px;">
								<button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
							</div>
						</div>
					</div>
				</div>
			</div>
    </div>
  </div>
	{include file="public/js"/}
	<script>
	//文件上传
	layui.upload.render({
		elem: '.uploadexcel',
		accept:'file',
		url: "{:url('upload/index')}",
		done: function(res){
			if(res.status==0){
				dialog(res.msg,0);
			}else{
				var item = this.item;
				var inputid = $(this.item).attr('upload-input');
				if(inputid){
					$('#'+inputid).val(res.url);
					$('#'+inputid).change();
				}
			}
		}
	});
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		$.post("{:url('importexcel')}",field,function(data){
			dialog(data.msg,data.status,data.url);
		})
	})
  </script>
	{include file="public/copyright"/}
</body>
</html>